<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      v-show="showSearch"
      label-width="68px"
    >
      <el-form-item label="企业名称" prop="nameEnterprise">
        <el-input
          v-model="queryParams.nameEnterprise"
          placeholder="请输入企业名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="品牌名称" prop="brandName">
        <el-input
          v-model="queryParams.brandName"
          placeholder="请输入品牌名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="开业时间" prop="openingHours">
        <el-date-picker
          clearable
          v-model="queryParams.openingHours"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择首店开业时间 ( 年/月/日 )"
        >
        </el-date-picker>
      </el-form-item>
      <el-form-item label="所属行业" prop="industry">
        <el-input
          v-model="queryParams.industry"
          placeholder="请输入所属行业 ( 餐饮 ，零售 ，文体 ，服务 )"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="联系人名" prop="nameOfcontactperson">
        <el-input
          v-model="queryParams.nameOfcontactperson"
          placeholder="请输入联系人姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="店型名称" prop="storeTypename">
        <el-input
          v-model="queryParams.storeTypename"
          placeholder="请输入店型名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <!-- <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['check:luru:edit']"
          >修改</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['check:luru:remove']"
          >删除</el-button
        >
      </el-col> -->
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['check:luru:export']"
          >导出</el-button
        >
      </el-col>
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
    </el-row>

    <el-table
      v-loading="loading"
      :data="luruList"
      @selection-change="handleSelectionChange"

    >
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="序号" align="center" prop="id" />
      <el-table-column label="企业名称" align="center" prop="nameEnterprise" />
      <el-table-column label="品牌名称" align="center" prop="brandName" />
      <el-table-column
        label="首店开业时间"
        align="center"
        prop="openingHours"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.openingHours, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="所属行业"
        width="95"
        align="center"
        prop="industry"
      />
      <el-table-column
        label="近2年内是否完成过股权融资"
        width="195"
        align="center"
        prop="equityFinancing"
      />
      <el-table-column
        label="累计融资额(万元)"
        align="center"
        width="105"
        prop="cumulativeFinancing"
      />
      <el-table-column
        label="实际控制人姓名"
        align="center"
        width="125"
        prop="nameOfactualcontroller"
      />
      <el-table-column
        label="联系人姓名"
        align="center"
        width="105"
        prop="nameOfcontactperson"
      />
      <el-table-column
        label="联系人职务"
        align="center"
        width="105"
        prop="positionOfcontactperson"
      />
      <el-table-column
        label="联系人手机号"
        align="center"
        width="115"
        prop="contactThephonenumber"
      />
      <el-table-column
        label="业务简介"
        align="center"
        width="300px"
        prop="businessIntroduction"
      />
      <el-table-column
        label="业务亮点"
        align="center"
        width="300px"
        prop="businessHighlights"
      />
      <el-table-column label="业务风险" width="300px" align="center" prop="businessRisk" />
      <el-table-column label="门店模式" align="center" prop="storeModel" />
      <el-table-column
        label="是否有《特许经营备案》"
        align="center"
        width="165"
        prop="franchisingRecord"
      />
      <el-table-column
        label="2020年度  直营模式(家)"
        align="center"
        width="135"
        prop="directSalesmodela"
      />
      <el-table-column
        label="2020年度  加盟模式(家)"
        align="center"
        width="135"
        prop="franchiseModea"
      />
      <el-table-column
        label="2020年度  营业收入(万元)"
        align="center"
        width="135"
        prop="operatingIncomea"
      />
      <el-table-column
        label="2021年度  直营模式(家)"
        align="center"
        width="135"
        prop="directSalesModelb"
      />
      <el-table-column
        label="2021年度  加盟模式(家)"
        align="center"
        width="135"
        prop="franchiseModeb"
      />
      <el-table-column
        label="2021年度  营业收入(万元)"
        align="center"
        width="135"
        prop="operatingIncomeb"
      />
      <el-table-column
        label="2022年度  直营模式(家)"
        align="center"
        width="135"
        prop="directSalesmodelc"
      />
      <el-table-column
        label="2022年度  加盟模式(家)"
        align="center"
        width="135"
        prop="franchiseModec"
      />
      <el-table-column
        label="2022年度  营业收入(万元)"
        align="center"
        width="135"
        prop="operatingIncomec"
      />
      <el-table-column
        label="2023年度至今  直营模式(家)"
        align="center"
        width="165"
        prop="directSalesModeld"
      />
      <el-table-column
        label="2023年度至今  加盟模式(家)"
        align="center"
        width="165"
        prop="franchiseModed"
      />
      <el-table-column label="闭店情况(家)" align="center" prop="storeClosured" />
      <el-table-column
        label="直营门店(家)"
        align="center"
        prop="directlyOperatedstores"
      />
      <el-table-column
        label="加盟门店(家)"
        align="center"
        prop="franchisedStores"
      />
      <el-table-column label="店型名称" align="center" prop="storeTypename" />
      <el-table-column
        label="单店投资额(万元)"
        width="105"
        align="center"
        prop="singleStoreinvestment"
      />
      <el-table-column
        label="年销售额(万元)"
        align="center"
        prop="annualSalesvolume"
      />
      <el-table-column label="客单价(元)" align="center" prop="guestUnitprice" />
      <el-table-column label="毛利率(%)" align="center" prop="grossProfitmargin" />
      <el-table-column
        label="净利润率(%)"
        width="105"
        align="center"
        prop="netProfitmargin"
      />
      <el-table-column label="回本期(月)" align="center" prop="periodOfreturn" />
      <el-table-column
        label="平均租期(月)"
        align="center"
        prop="averageLeaseterm"
      />
      <el-table-column label="门店面积(平米)" align="center" prop="storeSize" />
      <el-table-column
        label="贵司是否使用了订单管理系统(POS)并管理门店【全部渠道】订单销售数据？"
        width="245"
        align="center"
        prop="assessmentQuestionnairea"
      />
      <el-table-column
        label="营业收入是否采用核销制，即以订单实际的服务/交付行为作为收入确认条件，而非使用支付收入流水口径？"
        align="center"
        width="399"
        prop="assessmentQuestionnaireB"
      />
      <el-table-column
        label="商业计划书"
        width="170px"
        align="center"
        prop="businessPlan"

      >
        <template slot-scope="scope" >
        <el-button
              @click="openFile(scope.row)"
            >查看文件</el-button>
        </template>
      </el-table-column>


      <el-table-column label="加盟手册" align="center" prop="franchiseManual" width="170px">
        <template slot-scope="scope">
          <el-button
            @click="openFile02(scope.row)"
          >查看文件</el-button>
        </template>
      </el-table-column>

      <el-table-column label="加盟政策" align="center" prop="joiningPolicy" width="300px"/>
      <!-- <el-table-column
        label="操作"
        width="175"
        align="center"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['check:luru:edit']"
            >修改</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['check:luru:remove']"
            >删除</el-button
          >
        </template>
      </el-table-column> -->
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改登记对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="180px">
        <el-form-item label="企业名称" prop="nameEnterprise">
          <el-input
            v-model="form.nameEnterprise"
            placeholder="请输入企业名称"
          />
        </el-form-item>
        <el-form-item label="品牌名称" prop="brandName">
          <el-input v-model="form.brandName" placeholder="请输入品牌名称" />
        </el-form-item>
        <el-form-item label="首店开业时间" prop="openingHours">
          <el-date-picker
            clearable
            v-model="form.openingHours"
            type="date"
           value-format="yyyy-MM-dd"
           placeholder="请选择首店开业时间 ( 年/月/日 )"
         >
         </el-date-picker>
       </el-form-item>
        <el-form-item label="所属行业" prop="industry" >
          <el-select v-model="form.industry">
            <el-option
              v-for="item in industry"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
          <!-- <el-input
            v-model="form.industry"
            placeholder="请输入所属行业 ( 餐饮 ，零售 ，文体 ，服务 )"
          /> -->
        </el-form-item>

        <el-form-item label="股权融资" prop="equityFinancing">
          <el-select v-model="form.equityFinancing">
            <el-option
              v-for="item in equityFinancing"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
          <!-- <el-input
            v-model="form.equityFinancing"
            placeholder="请输入近2年内是否完成过股权融资"
          /> -->
        </el-form-item>
        <el-form-item label="累计融资额(万元)" prop="cumulativeFinancing">
          <el-input
            v-model="form.cumulativeFinancing"
            placeholder="请输入累计融资额"
          />
        </el-form-item>
        <el-form-item label="实际控制人姓名" prop="nameOfactualcontroller">
          <el-input
            v-model="form.nameOfactualcontroller"
            placeholder="请输入实际控制人姓名"
          />
        </el-form-item>
        <el-form-item label="联系人姓名" prop="nameOfcontactperson">
          <el-input
            v-model="form.nameOfcontactperson"
            placeholder="请输入联系人姓名"
          />
        </el-form-item>
        <el-form-item label="联系人职务" prop="positionOfcontactperson">
          <el-select v-model="form.positionOfcontactperson">
            <el-option
              v-for="item in positionOfcontactperson"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
          <!-- <el-input
            v-model="form.positionOfcontactperson"
            placeholder="创始人,股东,董事长,CEO,CCO,CFO,加盟商,其他 "
          /> -->
        </el-form-item>
        <el-form-item label="联系人手机号" prop="contactThephonenumber">
          <el-input
            v-model="form.contactThephonenumber"
            placeholder="请输入联系人手机号"
          />
        </el-form-item>
        <el-form-item label="业务简介" prop="businessIntroduction">
          <el-input type="textarea" maxlength="200"
            v-model="form.businessIntroduction"
            placeholder="请输入业务简介"
          />
        </el-form-item>
        <el-form-item label="业务亮点" prop="businessHighlights">
          <el-input type="textarea" maxlength="200"
            v-model="form.businessHighlights"
            placeholder="请输入业务亮点"
          />
        </el-form-item>
        <el-form-item label="业务风险" prop="businessRisk">
          <el-input type="textarea" maxlength="200" v-model="form.businessRisk" placeholder="请输入业务风险" />
        </el-form-item>
        <el-form-item label="门店模式" prop="storeModel">
          <el-select v-model="form.storeModel" @change="isjudej">
            <el-option
              v-for="item in storeModel"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
          <!-- <el-input
            v-model="form.storeModel"
            placeholder="直营,加盟,直营+加盟"
          /> -->
        </el-form-item>
        <el-form-item label="特许经营备案" prop="franchisingRecord">
          <el-select v-model="form.franchisingRecord" :disabled="Isdisabled">
            <el-option
              v-for="item in franchisingRecord"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
          <!-- <el-input
            v-model="form.franchisingRecord"
            placeholder="请输入是否有《特许经营备案》 ( 是 ，否 ，仅直售 )"
          /> -->
        </el-form-item>
        <el-form-item label="2020年 直营模式(家)" prop="directSalesmodela">
          <el-input
            v-model="form.directSalesmodela"
            placeholder="请输入2020年度直营模式"
          />
        </el-form-item>
        <el-form-item label="2020年  加盟模式(家)(如有)" prop="franchiseModea">
          <el-input
            v-model="form.franchiseModea"
            placeholder="请输入2020年度  加盟模式"
          />
        </el-form-item>
        <el-form-item label="2020年  营业收入(万元)" prop="operatingIncomea">
          <el-input
            v-model="form.operatingIncomea"
            placeholder="请输入2020年  营业收入"
          />
        </el-form-item>
        <el-form-item label="2021年  直营模式(家)" prop="directSalesModelb">
          <el-input
            v-model="form.directSalesModelb"
            placeholder="请输入2021年度  直营模式"
          />
        </el-form-item>
        <el-form-item label="2021年  加盟模式(家)(如有)" prop="franchiseModeb">
          <el-input
            v-model="form.franchiseModeb"
            placeholder="请输入2021年度  加盟模式"
          />
        </el-form-item>
        <el-form-item label="2021年  营业收入(万元)" prop="operatingIncomeb">
          <el-input
            v-model="form.operatingIncomeb"
            placeholder="请输入2021年度  营业收入"
          />
        </el-form-item>
        <el-form-item label="2022年  直营模式(家)" prop="directSalesmodelc">
          <el-input
            v-model="form.directSalesmodelc"
            placeholder="请输入2022年度  直营模式"
          />
        </el-form-item>
        <el-form-item label="2022年  加盟模式(家)(如有)" prop="franchiseModec">
          <el-input
            v-model="form.franchiseModec"
            placeholder="请输入2022年度  加盟模式"
          />
        </el-form-item>
        <el-form-item label="2022年  营业收入(万元)" prop="operatingIncomec">
          <el-input
            v-model="form.operatingIncomec"
            placeholder="请输入2022年  营业收入"
          />
        </el-form-item>
        <el-form-item label="2023后 直营模式(家)" prop="directSalesModeld">
          <el-input
            v-model="form.directSalesModeld"
            placeholder="请输入2023后 直营模式"
          />
        </el-form-item>
        <el-form-item label="2023后 加盟模式(家)(如有)" prop="franchiseModed">
          <el-input
            v-model="form.franchiseModed"
            placeholder="请输入2023后 加盟模式"
          />
        </el-form-item>
        <el-form-item label="闭店情况(家)" prop="storeClosured">
          <el-input v-model="form.storeClosured" placeholder="请输入闭店情况" />
        </el-form-item>
        <el-form-item label="直营门店(家)" prop="directlyOperatedstores">
          <el-input
            v-model="form.directlyOperatedstores"
            placeholder="请输入直营门店"
          />
        </el-form-item>
        <el-form-item label="加盟门店(家)" prop="franchisedStores">
          <el-input
            v-model="form.franchisedStores"
            placeholder="请输入加盟门店"
          />
        </el-form-item>
        <el-form-item label="店型名称" prop="storeTypename">
          <el-input v-model="form.storeTypename" placeholder="请输入店型名称" />
        </el-form-item>
        <el-form-item label="单店投资额(万元)" prop="singleStoreinvestment">
          <el-input
            v-model="form.singleStoreinvestment"
            placeholder="请输入单店投资额"
          />
        </el-form-item>
        <el-form-item label="年销售额(万元)" prop="annualSalesvolume">
          <el-input
            v-model="form.annualSalesvolume"
            placeholder="请输入年销售额"
          />
        </el-form-item>
        <el-form-item label="客单价(元)" prop="guestUnitprice">
          <el-input v-model="form.guestUnitprice" placeholder="请输入客单价" />
        </el-form-item>
        <el-form-item label="毛利率(%)" prop="grossProfitmargin">
          <el-input
            v-model="form.grossProfitmargin"
            placeholder="请输入毛利率"
          />
        </el-form-item>
        <el-form-item label="净利润率(%)" prop="netProfitmargin">
          <el-input
            v-model="form.netProfitmargin"
            placeholder="请输入净利润率(%)"
          />
        </el-form-item>
        <el-form-item label="回本期(月)" prop="periodOfreturn">
          <el-input v-model="form.periodOfreturn" placeholder="请输入回本期" />
        </el-form-item>
        <el-form-item label="平均租期(月)" prop="averageLeaseterm">
          <el-input
            v-model="form.averageLeaseterm"
            placeholder="请输入平均租期"
          />
        </el-form-item>
        <el-form-item label="门店面积(平米)" prop="storeSize">
          <el-input v-model="form.storeSize" placeholder="请输入门店面积" />
        </el-form-item>
        <el-form-item label="确认是否使用" prop="assessmentQuestionnairea">
          <el-select v-model="form.assessmentQuestionnairea">
            <el-option
              v-for="item in assessmentQuestionnairea"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
          <!-- <el-input
            style="width: 150px"
            v-model="form.assessmentQuestionnairea"
            placeholder="系统管理全部订单数据，系统管理部分订单数据，没有使用系统管理订单数据"
          />
          订单管理系统管理订单 -->
        </el-form-item>
        <el-form-item label="收入是否核销制" prop="assessmentQuestionnaireB">
          <el-select v-model="form.assessmentQuestionnaireB">
            <el-option
              v-for="item in assessmentQuestionnaireB"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
          <!-- <el-input
            v-model="form.assessmentQuestionnaireB"
            placeholder="请输入营业收入是否采用核销制？
 "
          />(即以订单实际的服务/交付行为作为收入确认条件，而非使用支付收入流水口径) -->
        </el-form-item>
        <!-- <el-form-item label="商业计划书" prop="businessPlan">
            <el-upload
              class="upload-demo"
              action="http://192.168.100.161:8089/check/luru/adde"
              :on-preview="handlePreview"
              :on-remove="handleRemove"
              :before-remove="beforeRemove"
              :before-upload="beforeUpload"
              :limit="1"
              :on-exceed="handleExceed"
              :file-list="fileList">
              <el-button size="small"  action="http://192.168.100.161:8089/check/luru/adde" type="primary">点击上传</el-button>
              <div slot="tip" class="el-upload__tip">只能上传pdf/docx文件,且不超过5MB</div>
            </el-upload>
        </el-form-item>

        <el-form-item label="加盟手册" prop="franchiseManual">
          <el-upload
              class="upload-demo"
              action="http://192.168.100.161:8089/check/luru/adde"
              :on-preview="handlePreview1"
              :on-remove="handleRemove1"
              :before-remove="beforeRemove1"
              multiple
              :limit="1"
              :on-exceed="handleExceed1"
              :file-list="fileList">
              <el-button size="small" type="primary">点击上传</el-button>
              <div slot="tip" class="el-upload__tip">只能上传pdf/docx文件,且不超过5MB</div>
            </el-upload>
        </el-form-item> -->
        <el-form-item label="加盟政策" prop="joiningPolicy">
          <el-input type="textarea" maxlength="200" v-model="form.joiningPolicy" placeholder="请输入加盟政策" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  listLuru,
  getLuru,
  delLuru,
  addLuru,
  updateLuru, getFile
} from '@/api/check/luru'
import { cleanLogininfor } from '@/api/monitor/logininfor'

export default {
  name: "Luru",
  data() {
    return {
      // 文件列表
      //fileList: [],
      //判断是否进行不可修改
      Isdisabled:false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 登记表格数据
      luruList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        nameEnterprise: null,
        brandName: null,
        openingHours: null,
        industry: null,
        equityFinancing: null,
        cumulativeFinancing: null,
        nameOfactualcontroller: null,
        nameOfcontactperson: null,
        positionOfcontactperson: null,
        contactThephonenumber: null,
        businessIntroduction: null,
        businessHighlights: null,
        businessRisk: null,
        storeModel: null,
        franchisingRecord: null,
        directSalesmodela: null,
        franchiseModea: null,
        operatingIncomea: null,
        directSalesModelb: null,
        franchiseModeb: null,
        operatingIncomeb: null,
        directSalesmodelc: null,
        franchiseModec: null,
        operatingIncomec: null,
        directSalesModeld: null,
        franchiseModed: null,
        storeClosured: null,
        directlyOperatedstores: null,
        franchisedStores: null,
        storeTypename: null,
        singleStoreinvestment: null,
        annualSalesvolume: null,
        guestUnitprice: null,
        grossProfitmargin: null,
        netProfitmargin: null,
        periodOfreturn: null,
        averageLeaseterm: null,
        storeSize: null,
        assessmentQuestionnairea: null,
        assessmentQuestionnaireB: null,
        businessPlan: null,
        franchiseManual: null,
        joiningPolicy: null,
      },
      // 表单参数
      form: {},
      //增加下拉框
      //请输入所属行业
      industry: '餐饮',
      industry: [{
          value: '餐饮',
          label: '餐饮'
        }, {
          value: '零售',
          label: '零售'
        }, {
          value: '文体',
          label: '文体'
        }, {
          value: '服务',
          label: '服务'
        }],
        //近两年是否进行过融资
        valueb:'是',
        equityFinancing: [{
          value: '是',
          label: '是'
        }, {
          value: '否',
          label: '否'
        }],
        //联系人职务
        valuec:'创始人',
        positionOfcontactperson: [{
          value: '创始人',
          label: '创始人'
        }, {
          value: '股东',
          label: '股东'
        }, {
          value: '董事长',
          label: '董事长'
        }, {
          value: 'CEO',
          label: 'CEO'
        }, {
          value: 'CCO',
          label: 'CCO'
        }, {
          value: 'CFO',
          label: 'CFO'
        }, {
          value: '加盟商',
          label: '加盟商'
        }, {
          value: '其他',
          label: '其他'
        }],
        //门店模式
        valued:'加盟',
        storeModel:[{
          value: '加盟',
          label: '加盟'
        }, {
          value: '直营',
          label: '直营'
        }, {
          value: '加盟+直营',
          label: '加盟+直营'
        }],
        valuee:'是',
        franchisingRecord:[{
          value: '是',
          label: '是'
        }, {
          value: '否',
          label: '否'
        }, {
          value: '仅直营',
          label: '仅直营'
        }],
        valuef:'系统管理全部订单数据',
        assessmentQuestionnairea:[{
          value: '系统管理全部订单数据',
          label: '系统管理全部订单数据'
        }, {
          value: '系统管理部分订单数据',
          label: '系统管理部分订单数据'
        }, {
          value: '没有使用系统订单管理数据',
          label: '没有使用系统订单管理数据'
        }],
        valueg:'是',
        assessmentQuestionnaireB:[{
          value: '是',
          label: '是'
        }, {
          value: '否',
          label: '否'
        }],
        // 表单校验
      rules: {
        nameEnterprise: [
          { required: true, message: "企业名称不能为空", trigger: "blur" },
        ],
        brandName: [
          { required: true, message: "品牌名称不能为空", trigger: "blur" },
        ],
        openingHours: [
          {
            required: true,
            message: "首店开业时间 ( 年/月/日 )不能为空",
            trigger: "blur",
          },
        ],
        industry: [
          {
            required: true,
            message: "所属行业 ( 餐饮 ，零售 ，文体 ，服务 )不能为空",
            trigger: "blur",
          },
        ],
        equityFinancing: [
          {
            required: true,
            message: "近2年内是否完成过股权融资 ( 是 ，否 )不能为空",
            trigger: "blur",
          },
        ],
        cumulativeFinancing: [
          { required: true, message: "累计融资额不能为空", trigger: "blur" },
          {
            pattern: /^(0|[1-9]\d*)(\.\d{1,2})?$/,
            message: '请输入非负数且最多包含两位小数的金额',
            trigger: 'blur'
          },
        ],
        nameOfactualcontroller: [
          {
            required: true,
            message: "实际控制人姓名不能为空",
            trigger: "blur",
          },{
            pattern: /^[a-zA-Z\s\u4e00-\u9fa5]+$/,
            message: '请输入格式正确的名字',
            trigger: 'blur'
          }
        ],
        nameOfcontactperson: [
          { required: true, message: "联系人姓名不能为空", trigger: "blur" },
          {
            pattern: /^[a-zA-Z\s\u4e00-\u9fa5]+$/,
            message: '请输入格式正确的名字',
            trigger: 'blur'
          },
        ],
        positionOfcontactperson: [
          {
            required: true,
            message:
              "联系人职务 ( 创始人 ，股东 ，董事长 ，CEO ?CCO , CFO , 加盟商 ， 其他 )不能为空",
            trigger: "blur",
          },
        ],
        contactThephonenumber: [
          { required: true, message: "联系人手机号不能为空", trigger: "blur" },
          {
            pattern: /^1[3456789]\d{9}$/,
            message: '手机号格式不正确',
            trigger: 'blur'
          },
        ],
        businessIntroduction: [
          { required: true, message: "业务简介不能为空", trigger: "blur" },
        ],
        businessHighlights: [
          { required: true, message: "业务亮点不能为空", trigger: "blur" },
        ],
        businessRisk: [
          { required: true, message: "业务风险不能为空", trigger: "blur" },
        ],
        storeModel: [
          {
            required: true,
            message: "门店模式 ( 直营 ，加盟 ，直营+加盟 )不能为空",
            trigger: "blur",
          },
        ],
        franchisingRecord: [
          {
            required: true,
            message: "是否有《特许经营备案》 ( 是 ，否 ，仅直售 )不能为空",
            trigger: "blur",
          },
        ],
        directSalesmodela: [
          {
            required: true,
            message: "2020年度  直营模式不能为空",
            trigger: "blur",
          },
          {
            pattern: /^[0-9]\d*$/,
            message: '请输入整数',
            trigger: 'blur'
          },
        ],
        franchiseModea:[
          {
              pattern: /^[0-9]\d*$/,
              message: '请输入整数',
              trigger: 'blur'
            },
        ],
        operatingIncomea: [
          {
            required: true,
            message: "2020年度  营业收入不能为空",
            trigger: "blur",
          },   {
            pattern: /^(0|[1-9]\d*)(\.\d{1,2})?$/,
            message: '请输入非负数且最多包含两位小数的金额',
            trigger: 'blur'
          },
        ],
        directSalesModelb: [
          {
            required: true,
            message: "2021年度  直营模式不能为空",
            trigger: "blur",
          }, {
              pattern: /^[0-9]\d*$/,
              message: '请输入整数',
              trigger: 'blur'
            },
        ],
        franchiseModeb:[
          {
              pattern: /^[0-9]\d*$/,
              message: '请输入整数',
              trigger: 'blur'
            },
        ],
        operatingIncomeb: [
          {
            required: true,
            message: "2021年度  营业收入不能为空",
            trigger: "blur",
          },   {
            pattern: /^(0|[1-9]\d*)(\.\d{1,2})?$/,
            message: '请输入非负数且最多包含两位小数的金额',
            trigger: 'blur'
          },
        ],
        directSalesmodelc: [
          {
            required: true,
            message: "2022年度  直营模式不能为空",
            trigger: "blur",
          }, {
              pattern: /^[0-9]\d*$/,
              message: '请输入整数',
              trigger: 'blur'
            },
        ],
        franchiseModec:[
          {
              pattern: /^[0-9]\d*$/,
              message: '请输入整数',
              trigger: 'blur'
            },
        ],
        operatingIncomec: [
          {
            required: true,
            message: "2022年度  营业收入不能为空",
            trigger: "blur",
          },   {
            pattern: /^(0|[1-9]\d*)(\.\d{1,2})?$/,
            message: '请输入非负数且最多包含两位小数的金额',
            trigger: 'blur'
          },
        ],
        directSalesModeld: [
          {
            required: true,
            message: "2023年度至今  直营模式不能为空",
            trigger: "blur",
          }, {
              pattern: /^[0-9]\d*$/,
              message: '请输入整数',
              trigger: 'blur'
            },
        ],
        franchiseModed:[{
              pattern: /^[0-9]\d*$/,
              message: '请输入整数',
              trigger: 'blur'
            },
        ],
        storeClosured: [
          { required: true, message: "闭店情况不能为空", trigger: "blur" },{
            pattern: /^[0-9]\d*$/,
            message: '请输入整数',
            trigger: 'blur'
          },
        ],
        directlyOperatedstores:[
        {
              pattern: /^[0-9]\d*$/,
              message: '请输入整数',
              trigger: 'blur'
            },
        ],
        franchisedStores:[
        {
              pattern: /^[0-9]\d*$/,
              message: '请输入整数',
              trigger: 'blur'
            },
        ],
        storeTypename: [
          { required: true, message: "店型名称不能为空", trigger: "blur" },
          {
            pattern: /^[\u4e00-\u9fa5]+$/,
            message: '请输入文字',
            trigger: 'blur'
          },
        ],
        singleStoreinvestment: [
          { required: true, message: "单店投资额不能为空", trigger: "blur" },   {
            pattern: /^(0|[1-9]\d*)(\.\d{1,2})?$/,
            message: '请输入非负数且最多包含两位小数的金额',
            trigger: 'blur'
          },
        ],
        guestUnitprice: [
          { required: true, message: "客单价不能为空", trigger: "blur" },   {
            pattern: /^(0|[1-9]\d*)(\.\d{1,2})?$/,
            message: '请输入非负数且最多包含两位小数的金额',
            trigger: 'blur'
          },
        ],
        grossProfitmargin: [
          { required: true, message: "毛利率不能为空", trigger: "blur" },{
            pattern: /^(?!-)\d+(\.\d+)?$/,
            message: '请输入整数或小数',
            trigger: 'blur'
          },
        ],
        netProfitmargin: [
          { required: true, message: "净利润率  (%)不能为空", trigger: "blur" },{
            pattern: /^(?!-)\d+(\.\d+)?$/,
            message: '请输入整数或小数',
            trigger: 'blur'
          },
        ],
        periodOfreturn: [
          { required: true, message: "回本期不能为空", trigger: "blur" },{
            pattern: /^[0-9]\d*$/,
            message: '请输入整数',
            trigger: 'blur'
          },
        ],
        averageLeaseterm: [
          { required: true, message: "平均租期不能为空", trigger: "blur" },{
            pattern: /^[0-9]\d*$/,
            message: '请输入整数',
            trigger: 'blur'
          },
        ],
        storeSize: [
          { required: true, message: "门店面积不能为空", trigger: "blur" },
          {
            pattern: /^(?!-)\d+(\.\d+)?$/,
            message: '请输入整数或小数',
            trigger: 'blur'
          },
        ],
        // assessmentQuestionnairea: [
        //   {
        //     required: true,
        //     message:
        //       "贵司是否使用了订单管理系统(POS)并管理门店【全部渠道】订单销售数据？ ( 系统管理全部订单数据 ，系统管理部分订单数据 ，没有使用系统管理订单数据 )不能为空",
        //     trigger: "blur",
        //   },
        // ],
        // assessmentQuestionnaireB: [
        //   {
        //     required: true,
        //     message:
        //       "营业收入是否采用核销制，即以订单实际的服务/交付行为作为收入确认条件，而非使用支付收入流水口径？( 是 ，否  )不能为空",
        //     trigger: "blur",
        //   },
        // ],
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    // //handleRemove：文件移除事件的处理方法，会在移除文件时被调用。
    // handleRemove(file, fileList) {
    //     console.log(file, fileList);
    //   },
    //   //handlePreview：文件预览事件的处理方法，会在点击文件预览时被调用。
    //   handlePreview(file) {
    //     console.log(file);
    //   },
    //   //handleExceed：超过文件数量限制时的提示事件的处理方法，会在选择文件超过限制时被调用。
    //   handleExceed(files, fileList) {
    //     this.$message.warning(`当前限制选择 1 个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`);
    //   },
    //   //限制文件上传时候最大的内存限制
    //   beforeUpload(file) {
    //   const isPDForDOCX = file.type === 'application/pdf' || file.type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
    //   const isLt5MB = file.size / 1024 / 1024 <= 5;

    //   if (!isPDForDOCX) { // 如果文件类型不合法
    //     this.$message.error('上传文件只能是 PDF 或 DOCX 格式!');
    //   }
    //   if (!isLt5MB) { // 如果文件大小超过限制
    //     this.$message.error('文件大小不能超过 5MB!');
    //   }

    //   return isPDForDOCX && isLt5MB; // 如果都符合要求就返回 true 继续上传，否则返回 false 取消上传
    // },
    //判断是否是直营
    isjudej(value){

        if (value === '直营') {
          this.form.franchisingRecord='直营';
          this.Isdisabled=true;

      }else{
        this.Isdisabled=false;
      }
    },
    /** 查询登记列表 */
    getList() {
      this.loading = true;
      listLuru(this.queryParams).then((response) => {
        this.luruList = response.rows;
        console.log("luruList"+this.luruList[0].businessPlan);
        this.total = response.total;

      });
		setTimeout(() => {
		  // 延迟执行的代码
		  this.loading = false;
		}, 500);
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        nameEnterprise: null,
        brandName: null,
        openingHours: null,
        industry: null,
        equityFinancing: null,
        cumulativeFinancing: null,
        nameOfactualcontroller: null,
        nameOfcontactperson: null,
        positionOfcontactperson: null,
        contactThephonenumber: null,
        businessIntroduction: null,
        businessHighlights: null,
        businessRisk: null,
        storeModel: null,
        franchisingRecord: null,
        directSalesmodela: null,
        franchiseModea: null,
        operatingIncomea: null,
        directSalesModelb: null,
        franchiseModeb: null,
        operatingIncomeb: null,
        directSalesmodelc: null,
        franchiseModec: null,
        operatingIncomec: null,
        directSalesModeld: null,
        franchiseModed: null,
        storeClosured: null,
        directlyOperatedstores: null,
        franchisedStores: null,
        storeTypename: null,
        singleStoreinvestment: null,
        annualSalesvolume: null,
        guestUnitprice: null,
        grossProfitmargin: null,
        netProfitmargin: null,
        periodOfreturn: null,
        averageLeaseterm: null,
        storeSize: null,
        assessmentQuestionnairea: null,
        assessmentQuestionnaireB: null,
        businessPlan: null,
        franchiseManual: null,
        joiningPolicy: null,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 上传文件 */
    openFile(row) {
      console.log("row.businessPlan="+row.businessPlan);
      window.open("http://123.56.64.164:8089" + row.businessPlan);
      //window.location.href="http://localhost:8084/"+row.businessPlan;

    },
    /** 上传文件 */
    openFile02(row) {
      console.log("row.franchiseManual="+row.franchiseManual);
      window.open("http://123.56.64.164:8089" + row.franchiseManual);
      //window.location.href="http://localhost:8084/"+row.businessPlan;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加登记";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids;
      getLuru(id).then((response) => {
        this.form = response.data;
        //刚进入的时候判断Isdisabled是否禁用
        if(this.form.storeModel=="直营"){
          this.Isdisabled=true;
        }else{
          this.Isdisabled=false;
        }
        this.open = true;
        this.title = "修改登记";
      });
    },
    /** 提交按钮 */
    submitForm() {






      this.$refs["form"].validate((valid) => {
        console.log("进入了")
        if (valid) {
          if (this.form.id != null) {
            updateLuru(this.form).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addLuru(this.form).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal
        .confirm('是否确认删除登记编号为"' + ids + '"的数据项？')
        .then(function () {
          return delLuru(ids);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "check/luru/export",
        {
          ...this.queryParams,
        },
        `luru_${new Date().getTime()}.xlsx`
      );
    },
  },
};
</script>
<style>
  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }
  .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }
</style>
